package com.yuyou.tas.admin.service;

import java.util.List;
import java.util.Map;

import com.yuyou.tas.admin.vo.req.AuthSubjectSection;
import com.yuyou.tas.admin.vo.req.ReqAuthUserAdd;
import com.yuyou.tas.admin.vo.req.ReqAuthUserUpdate;
import com.yuyou.tas.admin.vo.req.ReqSysAuthUserAdd;
import com.yuyou.tas.admin.vo.req.ReqSysAuthUserUpdate;
import com.yuyou.tas.service.api.admin.dto.*;
import com.yuyou.tas.service.api.admin.entity.AuthUser;
import com.yuyou.tas.service.api.admin.entity.AuthUserSection;
import com.yuyou.tas.service.api.lesson.entity.BaseSection;
import com.yuyou.tas.service.api.lesson.entity.LessonClassUserRel;
import com.yuyou.tas.util.bean.LoginRedisObj;
import com.yuyou.tas.util.bean.Pagination;
import com.yuyou.tas.util.bean.ResBoolSimpleInfo;

import org.apache.ibatis.annotations.Param;

/**
 * Created by yujin.liu on 2018/1/19.
 */
public interface IAuthUserService {

	ResBoolSimpleInfo<String> addOrUpUser(AuthUser authUser,boolean isOIdSycn) throws Exception;
	
	ResBoolSimpleInfo<String> addOrUpUsers(List<AuthUser> list,boolean isOIdSycn) throws Exception;
	
	AuthUser selectByPrimaryKey(Long id);
	
    AuthUserDTO findAuthUser(Long id);
    
    AuthUser selectBaseByPrimaryKey(Long id);

    ResBoolSimpleInfo insertAuthUser(ReqAuthUserAdd authUserAdd, LoginRedisObj loginObj);

    ResBoolSimpleInfo<String> updateAuthUser(ReqAuthUserUpdate authUserUpdate, LoginRedisObj loginObj);

    int updateByPrimaryKeySelective(AuthUser authUser);

    int deleteAuthUserById(Long id);

    int findAuthUserPageCount(Pagination<AuthUserDTO> p);

    List<AuthUserDTO> findAuthUserPageList(Pagination<AuthUserDTO> p);

    ResBoolSimpleInfo insertSysAuthUser(ReqSysAuthUserAdd sysAuthUserAdd, LoginRedisObj loginObj);

    int findSysAuthUserPageCount(Pagination<SysAuthUserDTO> p);

    List<SysAuthUserDTO> findSysAuthUserPageList(Pagination<SysAuthUserDTO> p);
    
    /**
     * 根据账号和机构ID查找用户
     * @param account
     * @param authOrganizationId
     * @return
     */
    AuthUser seleteUserByAcc7Organ(String account,Long authOrganizationId);
    
    AuthUser findUserByAcc7UserId(String userId,String account);

	ResBoolSimpleInfo<String> sycnUserByOId(List<SycnUserUpdateObj> list);
    
	AuthUser selectByOrgan7OId(Long oId,Long authOrganizationId);

	List<TeacherDTO> findTeacherList(Long data_subject, Long baseSectionId, String keyword, Long organizationId, Long lessonClassId, Integer type);

	List<SubjectSection> getSubjectSection(List<AuthUserSectionDTO> authUserSectionList, Map<Long, BaseSection> baseSectionMap);

    ResBoolSimpleInfo<String> updateSysAuthUser(ReqSysAuthUserUpdate sysAuthUserUpdate, LoginRedisObj loginObj);

    ResBoolSimpleInfo<String> updateStatus(Long id, Integer status);

	int insert(AuthUser record);

	ResBoolSimpleInfo<String> validateUserSubAndSec(String classNamesStr,
			List<AuthSubjectSection> ass, Long userId);

	/**
	 * 获取用户关联班级名字
	 * @param lessonClassUserRelList
	 * @return
	 */
	String getClassNamesStr(List<LessonClassUserRel> lessonClassUserRelList);

}
